package com.fable.sp.core.support;

/**
 * .
 *
 * @author stormning on 16/7/21.
 */
public class GridStackIE8CSSCreator {

    public static String gen(int height, int margin) {
        StringBuilder css = new StringBuilder();
        css.append(".grid-stack > .grid-stack-item { min-height:").append(height).append("px }");

        for (int i = 0; i < 100; i++) {
            int h = height * (i + 1) + margin * i;
            css.append(".grid-stack > .grid-stack-item[data-gs-height=\"").append(i + 1).append("\"] { height: ").append(h).append("px }");
        }

        for (int i = 0; i < 100; i++) {
            int h = height * (i + 1) + margin * i;
            css.append(".grid-stack > .grid-stack-item[data-gs-min-height=\"").append(i + 1).append("\"] { min-height: ").append(h).append("px }");
        }

        for (int i = 0; i < 100; i++) {
            int h = height * (i + 1) + margin * i;
            css.append(".grid-stack > .grid-stack-item[data-gs-max-height=\"").append(i + 1).append("\"] { max-height: ").append(h).append("px }");
        }

        for (int i = 0; i < 100; i++) {
            int h = height * i + margin * i;
            css.append(".grid-stack > .grid-stack-item[data-gs-y=\"").append(i).append("\"] { top: ").append(h).append("px }");
        }

        return css.toString();
    }

}
